package com.yxym.interclass;

public class AnonymousInnerClassDetail {
    public static void main(String[] args) {
        Outer05 outer05 = new Outer05();
        outer05.f();
    }
}

class Outer05 {
    private int n1 = 10;

    public void f() {
        //基于类名的匿名内部类
        Person person = new Person() {
            //运行匿名内部类的对象（Outer05）
            //class 匿名内部类extend Person{}
            //
            private int n1 = 20;

            @Override
            public void hi() {
                System.out.println("匿名内部类重写方法hi..." + "\t" + "n1=" + n1+  "\t"
                        + Outer05.this);
                System.out.println(Outer05.this);
            }
//            @Override
//            public void ha(String string) {
//                super.ha(string);
//            }
        };
        person.hi();
        //person.ha("你好");//直接调用hi，ha方法
    }
}

class Person{
    public void hi(){
        System.out.println("hi方法被调用...");
    }
//    public void ha(String string){
//        System.out.println(string);
//    }
}